package interfaces;

import com.google.protobuf.ByteString;
import com.google.protobuf.InvalidProtocolBufferException;

import java.rmi.Remote;
import java.rmi.RemoteException;

public interface NameNodeDef extends Remote {

    /**
     * 打开文件
     * @param inp openFileRequest
     * @return openFileResponse
     * @throws RemoteException 连接异常
     */
    byte[] openFile(byte[] inp) throws RemoteException;

    /**
     * 关闭文件
     * @param inp closeFileRequest
     * @return closeFileResponse
     * @throws RemoteException 连接异常
     */
    byte[] closeFile(byte[] inp ) throws RemoteException;

    /**
     * 返回block的存储位置
     * @param inp getBlockLocationsRequest
     * @return getBlockLocationsResponse
     * @throws RemoteException 连接异常
     */
    byte[] getBlockLocations(byte[] inp ) throws RemoteException;

    /**
     * 提供block存储位置
     * @param inp assignBlockRequest
     * @return assignBlockResponse
     * @throws RemoteException 连接异常
     */
    byte[] assignBlock(byte[] inp ) throws RemoteException;

    /**
     * 列出文件信息
     * @param inp ListFilesRequest
     * @return ListFilesResponse
     * @throws RemoteException 连接异常
     */
    byte[] list(byte[] inp) throws RemoteException;

    /**
     * 从datanode报告中获取块存储位置
     * @param inp BlockReportRequest
     * @return BlockReportResponse
     * @throws RemoteException
     */
    byte[] blockReport(byte[] inp ) throws RemoteException;

    byte[] SynFile(byte[] inp) throws RemoteException;

    byte[] getHeartBeat(byte[] inp) throws RemoteException;
}
